//
//  MXDMsgTableViewCell.m
//  MXFootBall
//
//  Created by dai on 2018/6/27.
//  Copyright © 2018年 zt. All rights reserved.
//

#import "MXDMsgTableViewCell.h"

@implementation MXDMsgTableViewCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self.contentView addSubview:self.timeLabel] ;
        [self.contentView addSubview:self.topView] ;
        
        [self.topView addSubview:self.msgTitleNameLabel] ;
        [self.topView addSubview:self.msgImage] ;
        [self.topView addSubview:self.msgContentLabel] ;
        [self.topView addSubview:self.msgTimeLabel] ;
        [self.topView addSubview:self.msgLabel] ;
        
    }
    return self ;
}

- (UILabel *)timeLabel {//消息时间
    if (_timeLabel == nil) {
        _timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(screen_width/2 - scaleWithSize(70), scaleWithSize(10), scaleWithSize(144), scaleWithSize(20))];
        _timeLabel.text = @"周三 18:20";
        _timeLabel.font = fontSize(scaleWithSize(12.0f));
        _timeLabel.backgroundColor = mx_Wode_colorcccccc;
        _timeLabel.textColor = [UIColor whiteColor];
        _timeLabel.textAlignment = 1;
        _timeLabel.layer.cornerRadius = 4.0f;
        _timeLabel.layer.masksToBounds = YES;
    }
    return _timeLabel;
}

- (UIView *)topView {
    if (_topView == nil) {
        _topView = [[UIView alloc] initWithFrame:CGRectMake(scaleWithSize(15), self.timeLabel.frame.size.height + scaleWithSize(20), screen_width - scaleWithSize(30), scaleWithSize(110))];
        _topView.backgroundColor = [UIColor whiteColor];
    }
    return _topView;
}

- (UILabel *)msgTitleNameLabel {//消息标题
    if (_msgTitleNameLabel == nil) {
        _msgTitleNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(scaleWithSize(10), scaleWithSize(10), screen_width - scaleWithSize(40), scaleWithSize(20))];
        _msgTitleNameLabel.text = @"重大消息";
        _msgTitleNameLabel.font = fontSize(scaleWithSize(19.0f));
        _msgTitleNameLabel.textAlignment = 1;
        _msgTitleNameLabel.hidden = YES;//
        //        _fansNickNameLabel.backgroundColor = [UIColor yellowColor];
    }
    return _msgTitleNameLabel;
}

- (UIImageView *)msgImage {
    if (!_msgImage) {
        _msgImage = [[UIImageView alloc]initWithFrame:CGRectMake(scaleWithSize(10), CGRectGetMaxY(self.msgTitleNameLabel.frame), scaleWithSize(59), scaleWithSize(59))] ;
    }
    return _msgImage ;
}
- (UILabel *)msgContentLabel {
    if (!_msgContentLabel) {
        _msgContentLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.msgImage.frame) + scaleWithSize(10), CGRectGetMinY(self.msgImage.frame), self.topView.size.width - CGRectGetMaxY(self.msgImage.frame) - scaleWithSize(20), scaleWithSize(20))] ;
        _msgContentLabel.font = fontSize(scaleWithSize(14.0f)) ;
    }
    return _msgContentLabel ;
}
- (UILabel *)msgTimeLabel {
    if (!_msgTimeLabel) {
        _msgTimeLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.msgImage.frame) + scaleWithSize(10), CGRectGetMinY(self.msgContentLabel.frame), self.msgContentLabel.size.width, scaleWithSize(20))] ;
        _msgTimeLabel.font = fontSize(scaleWithSize(11.0f)) ;
    }
    return _msgTimeLabel ;
}
- (UILabel *)msgLabel {
    if (!_msgLabel) {
        _msgLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.msgImage.frame) + scaleWithSize(10), CGRectGetMinY(self.msgTimeLabel.frame), self.msgContentLabel.size.width, scaleWithSize(20))] ;
        _msgLabel.font = fontSize(scaleWithSize(11.0f)) ;
    }
    return _msgLabel ;
}



- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
